<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      body {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      #map {
        position: relative;
        width: 300px;
        height: 300px;
        background-color: #999;
      }
    </style>
  </head>
  <body>
    <h1 id="grade">0</h1>
    <div id="map"></div>
    <script type="module">
      import Game from "./js/game.js";

      {
        let map = document.querySelector("#map");
        let game = new Game(map, 10);
        let gradeView = document.querySelector("#grade");

        game.on("changeGrade", (grade) => {
          console.log("changeGrade", grade);
        });
        game.on("win", () => {
          console.log("win");
        });
        game.on("gameOver", () => {
          console.log("over");
        });
        document.onclick = function () {
          game.start();
        };
      }
    </script>
  </body>
</html>
